﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using game.character.bullet;
using lumo;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Factories;
using FarseerPhysics.Dynamics.Contacts;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Audio;

namespace game.character.weapon
{
    /// <summary>
    /// The first weapon.
    /// </summary>
    public class PlayerWeapon : Weapon
    {

        Texture2D BulletTexture;
        SoundEffect ShotEffect;

        /// <summary>
        /// Simple constructor.
        /// </summary>
        /// <param name="Component"></param>
        public PlayerWeapon(LumoComponent Component) : base()
        {
            BulletTexture  = Component.Content.Load<Texture2D>("Graphics/Weapons/Bullet01");
            this.Texture   = Component.Content.Load<Texture2D>("Graphics/Weapons/Weapon01");
            ShotEffect = Component.Content.Load<SoundEffect>("Audio/SE/Shot");
            this.Origin    = new Vector2(4, 31);
            this.Damage = 100;
        }

        /// <summary>
        /// Shoot the bullet.
        /// </summary>
        /// <param name="BulletManager"></param>
        public override void Shoot(BulletManager BulletManager, Vector2 Origin, Vector2 Target, Vector2 AdditionalVelocity)
        {
            ActorBullet bullet = new ActorBullet(BulletTexture, Origin, Target, AdditionalVelocity);
            bullet.Damage = Damage;
            BulletManager.Emit(bullet);
            ShotEffect.Play();
        }

    }

}
